var mongoose = require('mongoose')
var Schema = mongoose.Schema

var userSchema = new Schema({
    email: {
        type: String,
        required: true,
    },
    nickname: {
        type: String,
        required: true,
    },
    password: {
        type: String,
        required: true,
    },
    created_time: {
        type: Date,
        default: Date.now,
    },
    last_modified_time: {
        type: Date,
        default: Date.now,
    },
    avatar: { //头像
        type: String,
        default: '/public/img/Eiza.jpg',
    },
    bio: { //简介
        type: String,
        default: '',
    },
    gender: { //性别
        type: Number,
        enum: [-1,0,1],
        default: -1
    },
    birthday: { //生日
        type: Date,
    },
    status: {
        type: Number,
        enum: [0,1,2], //0无限制，1不可评论，2不可登录
        default: 0
    }
})

module.exports = mongoose.model('User', userSchema)